package com.dews.information.domain.dto;

import com.dews.common.utils.DateUtils;
import com.dews.common.utils.valid.AddGroup;
import com.dews.common.utils.valid.UpdateGroup;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import jakarta.validation.constraints.NotBlank;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.NotNull;
import java.time.LocalDate;

/**
 * 学生信息详情对象Vo
 * 
 * @author qingfeng
 * @date 2025-01-14
 */
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@ToString
public class StudentInfoDTO {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty("主键")
    @NotNull(message = "主键不能为空", groups = {UpdateGroup.class})
    private Integer id;

    @ApiModelProperty("用户Id")
    @NotNull(message = "用户Id不能为空", groups = {UpdateGroup.class})
    private Long userId;

    @ApiModelProperty("院系")
    @NotNull(message = "院系不能为空", groups = {UpdateGroup.class})
    private Long depId;

    @ApiModelProperty("专业")
    @NotNull(message = "专业不能为空", groups = {UpdateGroup.class})
    private Integer subjectId;

    @ApiModelProperty("学号")
    @NotBlank(message = "学号不能为空", groups = {UpdateGroup.class})
    private String studentNum;

    @ApiModelProperty("姓名")
    @NotBlank(message = "姓名不能为空", groups = {AddGroup.class, UpdateGroup.class})
    private String studentName;

    @ApiModelProperty("出生日期")
    @DateTimeFormat(pattern = DateUtils.YYYY_MM_DD)
    @JsonFormat(pattern = DateUtils.YYYY_MM_DD, timezone = DateUtils.GMT)
    @NotNull(message = "出生日期不能为空", groups = {AddGroup.class, UpdateGroup.class})
    private LocalDate birth;

    @ApiModelProperty("民族")
    @NotBlank(message = "民族不能为空", groups = {AddGroup.class, UpdateGroup.class})
    private String nation;

    @ApiModelProperty("政治面貌")
    @NotBlank(message = "政治面貌不能为空", groups = {AddGroup.class, UpdateGroup.class})
    private String politicsStatus;

    @ApiModelProperty("入学时间")
    @DateTimeFormat(pattern = DateUtils.YYYY_MM_DD)
    @JsonFormat(pattern = DateUtils.YYYY_MM_DD, timezone = DateUtils.GMT)
    @NotNull(message = "入学时间不能为空", groups = {AddGroup.class, UpdateGroup.class})
    private LocalDate enterTime;

    @ApiModelProperty("毕业时间")
    @DateTimeFormat(pattern = DateUtils.YYYY_MM_DD)
    @JsonFormat(pattern = DateUtils.YYYY_MM_DD, timezone = DateUtils.GMT)
    @NotNull(message = "毕业时间不能为空", groups = {AddGroup.class, UpdateGroup.class})
    private LocalDate graduateTime;

    @ApiModelProperty("身份证号")
    @NotBlank(message = "身份证号不能为空", groups = {AddGroup.class, UpdateGroup.class})
//    @Pattern(regexp = "^[1-9]\\d{5}(18|19|20)\\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\\d{3}[0-9Xx]$", message = "身份证号格式不正确")
    private String idCard;

    @ApiModelProperty("在校状态")
    @NotBlank(message = "在校状态不能为空", groups = {AddGroup.class, UpdateGroup.class})
    private String stateSchool;

    @ApiModelProperty("年级")
    @NotBlank(message = "年级不能为空", groups = {AddGroup.class, UpdateGroup.class})
    private String grade;

    @ApiModelProperty("班级")
    @NotNull(message = "班级不能为空", groups = {AddGroup.class, UpdateGroup.class})
    private Integer clazzId;

    @ApiModelProperty("学制")
    @NotNull(message = "学制不能为空", groups = {AddGroup.class, UpdateGroup.class})
    private Integer educationalSystem;
}
